package com.arpa.wms.domain.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;

/**
 * 缺货登记类型
 * @program: wms
 * @description:
 * @author: xuyang
 * @create: 2020-10-23 10:21
 */
public enum StockoutTypeEnum implements IEnum<String> {
    /**
     * 拣货明细单状态
     */
    PICKING("0", "拣货时缺货登记"),
    // 为了与拣货单主表的状态保持一致，避免记忆错误，跳过了1
    OUT_CHECK("1", "复核时缺货登记");

    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    /**
     * 将值翻译为描述
     * @param value
     * @return
     */
    public static String translate(String value){
        for (StockoutTypeEnum item : StockoutTypeEnum.values()){
            if (item.getValue().equals(value)){
                return item.getDesc();
            }
        }
        return value;
    }

    StockoutTypeEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static StockoutTypeEnum getByValue(String value) {
        for (StockoutTypeEnum type : values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
